<script>
$(document).ready(function(){
	<?php if ($this->new_param):?>
	var new_param = <?php echo $this->new_param?> ;
	$.each(new_param,function(i,v){
		$("#"+v+"-element").append('<span class="new_param"><?php echo $this->translate('new param !')?></span>');
	});
	<?php endif?>
});
$("#paramForm").ajaxForm({
	dataType:  'json',
	success: showResponse
});
function showResponse(res) {
	if (res.error) {
		var message = '';
		$.each(res.error,function(i,val){
			$("#"+i).addClass('ui-state-error');
			$.each(val,function(ii,vv){
					message += $("#"+i+"-label label").html()+': '+ vv+ "\n";
			});
		});
		jAlert(message, '<?php echo $this->translate('checking errors')?>');
	}
	else{
		$(".new_param").remove();
		jAlert('<?php echo $this->translate('save completed')?>','<?php echo $this->translate('save completed')?>');
	}

}
</script>
<style>
.new_param {color:red;background:#ee3;border:#ccc solid thin;padding:3px;margin-left:5px}
</style>
<?php if ($this->paramform):?>
<?php $this->paramform->setAction($this->route('set-param'))?>
<?php echo $this->paramform?>
<?php endif?>
